﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Builder
{
    /// <summary>
    /// 指挥者，使用具体建造者对象进行构建
    /// </summary>
    class Director
    {
        private Builder builder;
        /// <summary>
        /// 指挥者构造
        /// </summary>
        /// <param name="builder">建造者</param>
        public Director(Builder builder)
        {
            this.builder = builder;
        }

        /// <summary>
        /// 产品构建与组装方法
        /// </summary>
        /// <returns></returns>
        public Product construct()
        {
            builder.buildPartA();
            builder.buildPartB();
            builder.buildPartC();
            return builder.getResult();
        }
    }
}
